home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / CIncludes / PictUtils.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  8.6 KB  |  210 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        PictUtils.h
  3.  
  4.      Contains:    Picture Utilities Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1990-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __PICTUTILS__
  18. #define __PICTUTILS__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23. #ifndef __PALETTES__
  24. #include <Palettes.h>
  25. #endif
  26.  
  27.  
  28.  
  29. #if PRAGMA_ONCE
  30. #pragma once
  31. #endif
  32.  
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36.  
  37. #if PRAGMA_IMPORT
  38. #pragma import on
  39. #endif
  40.  
  41. #if PRAGMA_STRUCT_ALIGN
  42.     #pragma options align=mac68k
  43. #elif PRAGMA_STRUCT_PACKPUSH
  44.     #pragma pack(push, 2)
  45. #elif PRAGMA_STRUCT_PACK
  46.     #pragma pack(2)
  47. #endif
  48.  
  49. /* verbs for the GetPictInfo, GetPixMapInfo, and NewPictInfo calls */
  50.  
  51. enum {
  52.     returnColorTable            = 0x0001,
  53.     returnPalette                = 0x0002,
  54.     recordComments                = 0x0004,
  55.     recordFontInfo                = 0x0008,
  56.     suppressBlackAndWhite        = 0x0010
  57. };
  58.  
  59.  
  60. enum {
  61.                                                                 /* color pick methods */
  62.     systemMethod                = 0,                            /* system color pick method */
  63.     popularMethod                = 1,                            /* method that chooses the most popular set of colors */
  64.     medianMethod                = 2,                            /* method that chooses a good average mix of colors */
  65.                                                                 /* color bank types */
  66.     ColorBankIsCustom            = -1,
  67.     ColorBankIsExactAnd555        = 0,
  68.     ColorBankIs555                = 1
  69. };
  70.  
  71. typedef long                             PictInfoID;
  72.  
  73. struct CommentSpec {
  74.     short                             count;                        /* number of occurrances of this comment ID */
  75.     short                             ID;                            /* ID for the comment in the picture */
  76. };
  77. typedef struct CommentSpec                CommentSpec;
  78. typedef CommentSpec *                    CommentSpecPtr;
  79. typedef CommentSpecPtr *                CommentSpecHandle;
  80.  
  81. struct FontSpec {
  82.     short                             pictFontID;                    /* ID of the font in the picture */
  83.     short                             sysFontID;                    /* ID of the same font in the current system file */
  84.     long                             size[4];                    /* bit array of all the sizes found (1..127) (bit 0 means > 127) */
  85.     short                             style;                        /* combined style of all occurrances of the font */
  86.     long                             nameOffset;                    /* offset into the fontNamesHdl handle for the font’s name */
  87. };
  88. typedef struct FontSpec                    FontSpec;
  89. typedef FontSpec *                        FontSpecPtr;
  90. typedef FontSpecPtr *                    FontSpecHandle;
  91.  
  92. struct PictInfo {
  93.     short                             version;                    /* this is always zero, for now */
  94.     long                             uniqueColors;                /* the number of actual colors in the picture(s)/pixmap(s) */
  95.     PaletteHandle                     thePalette;                    /* handle to the palette information */
  96.     CTabHandle                         theColorTable;                /* handle to the color table */
  97.     Fixed                             hRes;                        /* maximum horizontal resolution for all the pixmaps */
  98.     Fixed                             vRes;                        /* maximum vertical resolution for all the pixmaps */
  99.     short                             depth;                        /* maximum depth for all the pixmaps (in the picture) */
  100.     Rect                             sourceRect;                    /* the picture frame rectangle (this contains the entire picture) */
  101.     long                             textCount;                    /* total number of text strings in the picture */
  102.     long                             lineCount;                    /* total number of lines in the picture */
  103.     long                             rectCount;                    /* total number of rectangles in the picture */
  104.     long                             rRectCount;                    /* total number of round rectangles in the picture */
  105.     long                             ovalCount;                    /* total number of ovals in the picture */
  106.     long                             arcCount;                    /* total number of arcs in the picture */
  107.     long                             polyCount;                    /* total number of polygons in the picture */
  108.     long                             regionCount;                /* total number of regions in the picture */
  109.     long                             bitMapCount;                /* total number of bitmaps in the picture */
  110.     long                             pixMapCount;                /* total number of pixmaps in the picture */
  111.     long                             commentCount;                /* total number of comments in the picture */
  112.     long                             uniqueComments;                /* the number of unique comments in the picture */
  113.     CommentSpecHandle                 commentHandle;                /* handle to all the comment information */
  114.     long                             uniqueFonts;                /* the number of unique fonts in the picture */
  115.     FontSpecHandle                     fontHandle;                    /* handle to the FontSpec information */
  116.     Handle                             fontNamesHandle;            /* handle to the font names */
  117.     long                             reserved1;
  118.     long                             reserved2;
  119. };
  120. typedef struct PictInfo                    PictInfo;
  121. typedef PictInfo *                        PictInfoPtr;
  122. typedef PictInfoPtr *                    PictInfoHandle;
  123. typedef CALLBACK_API( OSErr , InitPickMethodProcPtr )(SInt16 colorsRequested, UInt32 *dataRef, SInt16 *colorBankType);
  124. typedef STACK_UPP_TYPE(InitPickMethodProcPtr)                     InitPickMethodUPP;
  125. enum { uppInitPickMethodProcInfo = 0x00000FA0 };                 /* pascal 2_bytes Func(2_bytes, 4_bytes, 4_bytes) */
  126. #define NewInitPickMethodProc(userRoutine)                         (InitPickMethodUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppInitPickMethodProcInfo, GetCurrentArchitecture())
  127. #define CallInitPickMethodProc(userRoutine, colorsRequested, dataRef, colorBankType)  CALL_THREE_PARAMETER_UPP((userRoutine), uppInitPickMethodProcInfo, (colorsRequested), (dataRef), (colorBankType))
  128. typedef CALLBACK_API( OSErr , RecordColorsProcPtr )(UInt32 dataRef, RGBColor *colorsArray, SInt32 colorCount, SInt32 *uniqueColors);
  129. typedef STACK_UPP_TYPE(RecordColorsProcPtr)                     RecordColorsUPP;
  130. enum { uppRecordColorsProcInfo = 0x00003FE0 };                     /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  131. #define NewRecordColorsProc(userRoutine)                         (RecordColorsUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppRecordColorsProcInfo, GetCurrentArchitecture())
  132. #define CallRecordColorsProc(userRoutine, dataRef, colorsArray, colorCount, uniqueColors)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppRecordColorsProcInfo, (dataRef), (colorsArray), (colorCount), (uniqueColors))
  133. typedef CALLBACK_API( OSErr , CalcColorTableProcPtr )(UInt32 dataRef, SInt16 colorsRequested, void *colorBankPtr, CSpecArray resultPtr);
  134. typedef STACK_UPP_TYPE(CalcColorTableProcPtr)                     CalcColorTableUPP;
  135. enum { uppCalcColorTableProcInfo = 0x00003EE0 };                 /* pascal 2_bytes Func(4_bytes, 2_bytes, 4_bytes, 4_bytes) */
  136. #define NewCalcColorTableProc(userRoutine)                         (CalcColorTableUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCalcColorTableProcInfo, GetCurrentArchitecture())
  137. #define CallCalcColorTableProc(userRoutine, dataRef, colorsRequested, colorBankPtr, resultPtr)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppCalcColorTableProcInfo, (dataRef), (colorsRequested), (colorBankPtr), (resultPtr))
  138. typedef CALLBACK_API( OSErr , DisposeColorPickMethodProcPtr )(UInt32 dataRef);
  139. typedef STACK_UPP_TYPE(DisposeColorPickMethodProcPtr)             DisposeColorPickMethodUPP;
  140. enum { uppDisposeColorPickMethodProcInfo = 0x000000E0 };         /* pascal 2_bytes Func(4_bytes) */
  141. #define NewDisposeColorPickMethodProc(userRoutine)                 (DisposeColorPickMethodUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppDisposeColorPickMethodProcInfo, GetCurrentArchitecture())
  142. #define CallDisposeColorPickMethodProc(userRoutine, dataRef)     CALL_ONE_PARAMETER_UPP((userRoutine), uppDisposeColorPickMethodProcInfo, (dataRef))
  143. EXTERN_API( OSErr )
  144. GetPictInfo                        (PicHandle                 thePictHandle,
  145.                                  PictInfo *                thePictInfo,
  146.                                  short                     verb,
  147.                                  short                     colorsRequested,
  148.                                  short                     colorPickMethod,
  149.                                  short                     version)                            THREEWORDINLINE(0x303C, 0x0800, 0xA831);
  150.  
  151. EXTERN_API( OSErr )
  152. GetPixMapInfo                    (PixMapHandle             thePixMapHandle,
  153.                                  PictInfo *                thePictInfo,
  154.                                  short                     verb,
  155.                                  short                     colorsRequested,
  156.                                  short                     colorPickMethod,
  157.                                  short                     version)                            THREEWORDINLINE(0x303C, 0x0801, 0xA831);
  158.  
  159. EXTERN_API( OSErr )
  160. NewPictInfo                        (PictInfoID *            thePictInfoID,
  161.                                  short                     verb,
  162.                                  short                     colorsRequested,
  163.                                  short                     colorPickMethod,
  164.                                  short                     version)                            THREEWORDINLINE(0x303C, 0x0602, 0xA831);
  165.  
  166. EXTERN_API( OSErr )
  167. RecordPictInfo                    (PictInfoID             thePictInfoID,
  168.                                  PicHandle                 thePictHandle)                        THREEWORDINLINE(0x303C, 0x0403, 0xA831);
  169.  
  170. EXTERN_API( OSErr )
  171. RecordPixMapInfo                (PictInfoID             thePictInfoID,
  172.                                  PixMapHandle             thePixMapHandle)                    THREEWORDINLINE(0x303C, 0x0404, 0xA831);
  173.  
  174. EXTERN_API( OSErr )
  175. RetrievePictInfo                (PictInfoID             thePictInfoID,
  176.                                  PictInfo *                thePictInfo,
  177.                                  short                     colorsRequested)                    THREEWORDINLINE(0x303C, 0x0505, 0xA831);
  178.  
  179. EXTERN_API( OSErr )
  180. DisposePictInfo                    (PictInfoID             thePictInfoID)                        THREEWORDINLINE(0x303C, 0x0206, 0xA831);
  181.  
  182. #if OLDROUTINENAMES
  183. #define DisposPictInfo(thePictInfoID) DisposePictInfo(thePictInfoID)
  184. #endif  /* OLDROUTINENAMES */
  185.  
  186.  
  187.  
  188.  
  189.  
  190. #if PRAGMA_STRUCT_ALIGN
  191.     #pragma options align=reset
  192. #elif PRAGMA_STRUCT_PACKPUSH
  193.     #pragma pack(pop)
  194. #elif PRAGMA_STRUCT_PACK
  195.     #pragma pack()
  196. #endif
  197.  
  198. #ifdef PRAGMA_IMPORT_OFF
  199. #pragma import off
  200. #elif PRAGMA_IMPORT
  201. #pragma import reset
  202. #endif
  203.  
  204. #ifdef __cplusplus
  205. }
  206. #endif
  207.  
  208. #endif /* __PICTUTILS__ */
  209.  
  210.